{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1450
  Verdict: Accepted
}
uses SysUtils, Math;
 
var
	als,ls,i,j,k,kk,cls:longint;
	s,t,ans,p:string;
	f:boolean;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(S);
ls:=length(s);
ans:='';
als:=0;
for i:=1 to ls do begin
	t:=s;
	j:=pos(s[i],t);
	while (j<i) and (j<>0) do begin
		t[j]:='?';
		j:=pos(s[i],t);
	end;
	while j>0 do begin
		p:=copy(s,i,j-i+1);
		cls:=length(p);
		if cls>als then begin
			kk:=cls div 2;
			f:=true;
			for k:=1 to kk do
				if p[k]<>p[cls+1-k] then begin
					f:=false;
					break;
				end;
			if f then begin
				als:=cls;
				ans:=p;
			end;
		end;
		t[j]:='?';
		j:=pos(s[i],t);
	end;
end;
write(ans);
end.